package com.ckn.factory;

import com.ckn.strategy.PayHandler;

import java.util.HashMap;
import java.util.Map;

/**
 * @Author chenkangning
 * @Date 2024/6/14 11:26
 */
public class PayFactory {

    private static Map<String, PayHandler> strategyMap = new HashMap<>();

    public static void register(String name,PayHandler handler){
        if (null == name || null == handler){
            return;
        }
        strategyMap.put(name,handler);
    }

    public static PayHandler getInvokeStrategy(String payCode) {
        return strategyMap.get(payCode);
    }

}
